<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :rules="rules" label-width="100px" id="mvcfm">
      <div class="form-unit">
        <span class="mvc-title-left"> 我的已办 </span>
      </div>
      <div>
      </div> 请假类型 <el-select v-model="empty">
        <el-option label="所有" value="所有" />
      </el-select> 流程实例ID <div class="el-select">
        <el-input v-model="empty" />
      </div>
      <el-button @click="gotoPage(''+vueparams+'')" type='primary' size="mini"><i class='fa fa-search'></i>搜索</el-button>
      <el-button @click="gotoPage(''+vueparams+'')" type='warning' size="mini"><i class='fa fa-refresh'></i>重置</el-button>
      <el-table :data="pageList" v-loading="loading" @selection-change="handleSelectionChange">
        <el-table-column label="操作" align="center" width='100' type=''>
          <template slot-scope="scope">
            <el-dropdown trigger="click">
              <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item>
                  <el-link @click="gotoPage(''+vueparams+'')">申请详情 </el-link>
                </el-dropdown-item>
                <el-dropdown-item>
                  <el-link @click="gotoPage(''+vueparams+'')">审批历史</el-link>
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </template>
        </el-table-column>
        <el-table-column label="#" align="center" type='selection'>
        </el-table-column>
        <el-table-column label="主键ID" prop="id">
        </el-table-column>
        <el-table-column label="请假类型" prop="type">
        </el-table-column>
        <el-table-column label="标题" prop="title">
        </el-table-column>
        <el-table-column label="原因" prop="reason">
        </el-table-column>
        <el-table-column label="开始时间" prop="start_time">
        </el-table-column>
        <el-table-column label="结束时间" prop="end_time">
        </el-table-column>
        <el-table-column label="请假时长" prop="total_time">
        </el-table-column>
        <el-table-column label="流程实例ID" prop="instance_id">
        </el-table-column>
        <el-table-column label="<span style=" color: red;">申请人</span>" prop="apply_user_name" > </el-table-column>
        <el-table-column label="申请时间" prop="apply_time">
        </el-table-column>
        <el-table-column label="任务ID" prop="task_id">
        </el-table-column>
        <el-table-column label="已办任务名称" prop="task_name">
        </el-table-column>
        <el-table-column label="办理时间" prop="done_time">
        </el-table-column>
      </el-table>
    </el-form>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'leaveDone',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        loading: true,
        pageList: [],
        pageSize: 10,
        total: null,
        elcheck: [],
        multiple: true,
        rules: {}
      }
    },
    created() {
      this.getPage(1);
    },
    updated() {},
    mounted() {},
    methods: {
      submitApply(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/oa/process/CounterSign/submitApply?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      showVerifyDialog(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/oa/process/CounterSign/showVerifyDialog?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      taskDoneList(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/oa/process/CounterSign/taskDoneList?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      getPage(page) {
        this.loading = true;
        request({
          method: 'get',
          url: '/xcapi/VUEAction/oa/process/CounterSign/taskDoneList?' + this.vueparams,
          params: {
            pageNo: page
          }
        }).then(data => {
          this.loading = false;
          this.pageList = data.rows;
          this.total = data.total;
        })
      },
      handleSelectionChange(selection) {
        this.elcheck = selection.map(item => item["id"]);
        this.single = selection.length != 1;
        this.multiple = !selection.length;
      },
    },
  }
</script>
